// 定义一个和Number类似的关键词  
console.log(new Number('3').constructor === Number)
console.log(new Array().constructor === Array)
console.log({}.constructor === Object)


// 实现一个类似的
function Tree(message) {
    this.message = message
}
const tree = new Tree("Tree函数实例");
console.log(tree.constructor == Tree) // true
// console.log(tree.constructor == Object) //fasle

var types = [
    new Array,
    [],
    new Boolean,
    true, // remains unchanged
    new Date,
    new Error,
    new Function,
    function () {},
    Math,
    new Number,
    1, // remains unchanged
    new Object,
    {},
    new RegExp,
    /(?:)/,
    new String,
    "test" // remains unchanged
];


for (var i = 0; i < types.length; i++) {
    types[i].constructor = Tree;
    types[i] = [types[i].constructor, types[i] instanceof Tree, types[i].toString()];
};

console.log("tree实例" +11+ tree.constructor == Object) //true